package com.bsfcs.rag.controller;

import com.bsfcs.rag.entity.ChatParam;
import com.bsfcs.rag.service.ChatService;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
import org.springframework.ai.chat.client.advisor.vectorstore.QuestionAnswerAdvisor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@RestController
@RequestMapping("/chat")
public class ChatController {

    @Autowired
    private ChatService chatService;

    @PostMapping("/query")
    public Flux<String> generation(@RequestBody ChatParam chatParam) {
        return chatService.chat(chatParam);
    }
}